package com.jiepos.mpos.biz.appInfM.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;

import com.jiepos.mpos.biz.appInfM.service.FeedbackService;
import com.jiepos.mpos.common.entity.App_Client_FeedBackEntity;
import com.jiepos.mpos.common.entity.App_Ins_InfEntity;
import com.jiepos.mpos.core.controller.BaseController;
import com.jiepos.mpos.core.entity.Pagination;

/**
 *
 *
 * <p>标题: —— 系统参数控制器</p>
 * <p>模块: 通用平台</p>
 * <p>版权: Copyright (c) 2017 江苏杰博实信息技术有限公司
 * @author 余翼膑
 * @version 1.0
 * @since 2017年9月25日
 * @history（历次修订内容、修订人、修订时间等）
 */
@Controller
@RequestMapping("feedBack")
public class FeedbackController extends BaseController  {

    @Autowired
    private FeedbackService feedbackService;

    /**
     * 进入客户端反馈意见列表页面
     * @param request
     * @param response
     * @param pagination
     * @return
     */
    @RequestMapping("/getFeedBackList.do")
    public ModelAndView getOrganizationList(HttpServletRequest request, HttpServletResponse response, Pagination pagination){

        ModelAndView model = new ModelAndView("/module/appInfM/feedback/feedback_list");
        return super.getDetail(request, response, model);
    }
    /**
     * 查询通道列表信息json数据
     * @param pagination
     * @param appClientFeedBackEntity
     * @return
     */
    @RequestMapping("/feedBackListJson.do")
    public @ResponseBody
    Map getFeedBackListJson(Pagination pagination, App_Client_FeedBackEntity  appClientFeedBackEntity,App_Ins_InfEntity appInsInfEntity){
        return feedbackService.getFeedBackList(pagination, appClientFeedBackEntity,appInsInfEntity);
    }
    /**
     * 进入客户端反馈详细页面
     * @param request
     * @param response
     * @param pagination
     * @param feedback_uuid
     * @return
     */
    @RequestMapping("/getFeedBackDetail.do")
    public ModelAndView getFeedBackDetail(HttpServletRequest request, HttpServletResponse response,
                                              Pagination pagination,String feedback_uuid) {
        ModelAndView model = new ModelAndView("/module/appInfM/feedback/feedback_detail");
        // 菜单编码
        Map infEntity = feedbackService.getFeedBackById(feedback_uuid);
        model.addObject("infEntity", infEntity);
        return super.getDetail(request, response, model);
    }
    /**
     * 保存客户端反馈意见
     * @param request
     * @param response
     * @param appClientFeedBackEntity
     * @return
     */
    @RequestMapping("/saveFeedBackDetail.do")
    public ModelAndView saveOrganizationDetail(HttpServletRequest request, HttpServletResponse response, App_Client_FeedBackEntity appClientFeedBackEntity) {

        feedbackService.saveFeedBack(appClientFeedBackEntity, super.getLoginUser(request, response));
        Map map=super.getLoginUser(request, response);
        return new ModelAndView(new RedirectView("getFeedBackList.do"), map);
    }
}
